@lacneu/atrium 0.26.0 → 0.26.1
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-Cr5N8yhW.js → AccessTab-C_Lvzi-s.js} +1 -1
- package/dist/assets/{AdvancedFilter-B0eHnjhM.js → AdvancedFilter-DnGyDWXx.js} +1 -1
- package/dist/assets/{AgentFilesTab-DYOMoQSt.js → AgentFilesTab-mB_H9qhv.js} +1 -1
- package/dist/assets/{AnomaliesTab-nz3nwVcD.js → AnomaliesTab-DXWIdPjg.js} +1 -1
- package/dist/assets/{AuditTab-CB_hCgt6.js → AuditTab-CM3yKrcE.js} +1 -1
- package/dist/assets/{BridgeTab-DM0F3JBU.js → BridgeTab-Bba1_oYY.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-BtuWRKtn.js → ChatDefaultsTab-BJWGY5p4.js} +1 -1
- package/dist/assets/{DataTableShell-_imgfnfL.js → DataTableShell-y4F1v6a9.js} +1 -1
- package/dist/assets/{DetailChips-WfEcflRX.js → DetailChips-BFrPLaU7.js} +1 -1
- package/dist/assets/{FeedbacksTab-C4iIYq5Y.js → FeedbacksTab-Dypzq2xC.js} +1 -1
- package/dist/assets/{FieldLabel-BotruMTL.js → FieldLabel-GI9NETEt.js} +1 -1
- package/dist/assets/{FilesTab-BFVLvM1M.js → FilesTab-Bo0mLlHv.js} +1 -1
- package/dist/assets/{FilterBar-BToerIZw.js → FilterBar-B_mSpGb-.js} +1 -1
- package/dist/assets/{GroupsTab-5kzQ6PtY.js → GroupsTab-BsdKKpSh.js} +1 -1
- package/dist/assets/{InstancesTab-BZpH16Od.js → InstancesTab-AFQsddYr.js} +1 -1
- package/dist/assets/{IntegrationsTab-CSl1HRb5.js → IntegrationsTab-_AZobXTN.js} +1 -1
- package/dist/assets/{KpiTab-DdSoOlaJ.js → KpiTab-DS2vaP8Y.js} +1 -1
- package/dist/assets/{PreferencesTab-s6Un7hWK.js → PreferencesTab-D5id-SH6.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-DCB2c8bq.js → PromptInjectionsTab-DHLbMEQv.js} +1 -1
- package/dist/assets/{RolesTab-DNEUHTSy.js → RolesTab-DfLWu7KJ.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-7Hc91j9Y.js → ServiceAccountsTab-BdNBgyiw.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-DRhw4EHt.js → SubAgentReportsTab-DiGx-0oc.js} +1 -1
- package/dist/assets/{ThemeShowroom-Di-KW-H4.js → ThemeShowroom-BAS4cMDv.js} +1 -1
- package/dist/assets/{TimeRangePicker-Cm-XSScp.js → TimeRangePicker-CFCLAlKB.js} +1 -1
- package/dist/assets/{TracesTab-BR-e3nla.js → TracesTab-w5olufef.js} +1 -1
- package/dist/assets/{UsersTab-Cf7ZWEnT.js → UsersTab-DFcSXBQJ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BMbd79DX.js → highlighted-body-OFNGDK62-D8Rm1ZUS.js} +1 -1
- package/dist/assets/{index-Cs-A4Qz2.js → index-BlRMvXrJ.js} +70 -70
- package/dist/assets/mermaid-GHXKKRXX-CS3UuvWM.js +1 -0
- package/dist/assets/{tabs-CVbQ8jlY.js → tabs-DT8VXxMj.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-ClP4KTsZ.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,EO as i,Fo as a,Go as o,Ho as s,Io as c,Jo as l,KD as u,Ko as d,Lo as f,Po as p,Ro as m,Uo as h,Vo as g,Wo as _,qo as v,yO as y,zo as b}from"./dist-Cxz8d8g5.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,EO as i,Fo as a,Go as o,Ho as s,Io as c,Jo as l,KD as u,Ko as d,Lo as f,Po as p,Ro as m,Uo as h,Vo as g,Wo as _,qo as v,yO as y,zo as b}from"./dist-Cxz8d8g5.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-BlRMvXrJ.js";var D=t(e(),1);function O(e){return e===`user`?m():e===`all`?f():c({group:e.group})}function k(e){return e===`common`?a():e===`owner`?p():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=i(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":v(),children:(0,A.jsx)(x,{placeholder:v()})}),(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:d()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:o()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children: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:s()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-Cxz8d8g5.js";import{i as u}from"./dist-CZgL-Z5m.js";import{t as d}from"./x-BimfpZdd.js";import{t as f}from"./button-BOkPsnkZ.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-
|
|
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-Cxz8d8g5.js";import{i as u}from"./dist-CZgL-Z5m.js";import{t as d}from"./x-BimfpZdd.js";import{t as f}from"./button-BOkPsnkZ.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-BlRMvXrJ.js";import{r as b}from"./TimeRangePicker-CFCLAlKB.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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CO as r,Ci as i,Di as a,EO as o,Ei as s,JD as ee,KD as c,LS as l,Oi as te,Si as ne,Ti as u,_i as re,ai as d,bi as ie,ci as f,di as p,ei as m,fa as h,fi as g,gi as _,hi as v,ii as y,ki as b,li as x,mi as S,ni as C,oi as w,pi as ae,ri as T,si as E,ti as D,ua as oe,ui as se,vi as O,wi as k,xi as ce,yO as A,yi as j}from"./dist-Cxz8d8g5.js";import{t as M}from"./button-BOkPsnkZ.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-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CO as r,Ci as i,Di as a,EO as o,Ei as s,JD as ee,KD as c,LS as l,Oi as te,Si as ne,Ti as u,_i as re,ai as d,bi as ie,ci as f,di as p,ei as m,fa as h,fi as g,gi as _,hi as v,ii as y,ki as b,li as x,mi as S,ni as C,oi as w,pi as ae,ri as T,si as E,ti as D,ua as oe,ui as se,vi as O,wi as k,xi as ce,yO as A,yi as j}from"./dist-Cxz8d8g5.js";import{t as M}from"./button-BOkPsnkZ.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-BlRMvXrJ.js";import{i as G}from"./compatView-CcKTaWCH.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
2
|
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
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=o(A.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),l=o(A.admin.listInstances,e!==void 0&&t?{}:`skip`),[d,f]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!l||l.length===0||(!d||!l.some(e=>e.name===d))&&f(l[0].name)},[t,l,d]);let p=o(A.agents.listAgentsForInstance,t&&d?{instanceName:d}:`skip`),m=o(A.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),h=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return d===null||p===void 0?l!==void 0&&l.length===0?[]:void 0:p.agents.map(e=>({instanceName:d,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(m!==void 0)return m.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,d,p,l,m]),[g,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!h||h.length===0||(!g||!h.some(e=>$(e)===g))&&_($(h[0]))},[h,g]);let v=h?.find(e=>$(e)===g)??null,y=r(A.agentFiles.listAgentFiles),[x,S]=(0,K.useState)({status:`idle`}),C=v?.instanceName??null,w=v?.agentId??null,ae=o(A.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),T=n&&C!==null?H(ae,`agentFiles`):null,E=T===null?!1:T===`loading`?null:T.blocked,D=(0,K.useCallback)(async()=>{if(!(C===null||w===null)){S({status:`loading`});try{S({status:`done`,files:(await y({instanceName:C,agentId:w})).files})}catch{S({status:`error`})}}},[y,C,w]);(0,K.useEffect)(()=>{E===!1&&D()},[D,E]);let[se,N]=(0,K.useState)(null),P=ee(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||h===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(l?.length??0)>1?(0,Q.jsxs)(W,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":te(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(l??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,h.length>0?(0,Q.jsxs)(W,{value:g??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:h.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),v===null?null:T===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):T!==null&&T.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(T.gatewayVersion)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[k(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:oe()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:x.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:ne({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:ce({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(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?O():re()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:j({used:Z(be(x.files),P),total:Z(J,P),pct:F.format(X(be(x.files)))})})]}),se&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:se.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=r(A.agentFiles.getAgentFile),te=r(A.agentFiles.setAgentFile),ne=P(),[u,re]=(0,K.useState)(null),[ie,b]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[ce,j]=(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=>{b(!1);try{let i=await s({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),z(!1)}catch{b(!0)}},[s,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(u!==null){L(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:u.updatedAtMs??void 0}),ne.success(se({name:n})),o(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=u!==null&&O!==u.content,G=(0,K.useMemo)(()=>u===null?null:Se(u.content,O),[u,O]),J=O.length>q,Y=ee(),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:[` · `,S()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!i,spellCheck:!1,onChange:e=>k(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:[E(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:w()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:x()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:g({count:X.format(O.length),max:X.format(q)})}),i?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?h():p()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:d({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:T({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:C()}),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:D()}),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:l()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:m()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Bm as i,Cm as a,Dm as o,EO as s,Em as c,Fm as ee,Gm as te,Hm as ne,Im as l,Jm as u,Km as d,Lm as f,Mm as p,Nm as m,Om as h,Pm as g,Rm as re,Sm as ie,TO as ae,Tm as _,Um as oe,Vm as se,Wm as ce,_m as le,bm as ue,cm as v,dm as de,fm as fe,gm as pe,hm as me,jm as he,km as ge,lm as y,mm as b,om as x,pm as S,qm as C,sm as w,um as T,vm as E,wm as D,xm as O,yO as k,ym as A,zm as j}from"./dist-Cxz8d8g5.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-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Bm as i,Cm as a,Dm as o,EO as s,Em as c,Fm as ee,Gm as te,Hm as ne,Im as l,Jm as u,Km as d,Lm as f,Mm as p,Nm as m,Om as h,Pm as g,Rm as re,Sm as ie,TO as ae,Tm as _,Um as oe,Vm as se,Wm as ce,_m as le,bm as ue,cm as v,dm as de,fm as fe,gm as pe,hm as me,jm as he,km as ge,lm as y,mm as b,om as x,pm as S,qm as C,sm as w,um as T,vm as E,wm as D,xm as O,yO as k,ym as A,zm as j}from"./dist-Cxz8d8g5.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-BlRMvXrJ.js";import{n as be}from"./TimeRangePicker-CFCLAlKB.js";import{t as xe}from"./FilterBar-B_mSpGb-.js";import{t as Se}from"./DataTableShell-y4F1v6a9.js";import{t as H}from"./dispatchErrorInfo-_T-F61vE.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?u():e===`acknowledged`?C():d()}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??``,u=e.status===K?G:e.status,d=e.severity??G,v=e.kind??G,[y,x]=(0,U.useState)(G),C=ye(e.from,e.to),{from:w,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=ae(k.anomalies.resolveAnomaly),Fe=(s(k.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=s(k.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:w,to:H,anomalyStatus:u===G?void 0:u,severity:d===G?void 0:d,source:y===G?void 0:y,kind:v===G?void 0:v}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||u!==`open`||d!==G||y!==G||v!==G||C.kind!==`relative`||C.from!==De.from;function Re(){x(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:te(),description:(0,W.jsxs)(W.Fragment,{children:[ce(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,oe(),` `,(0,W.jsx)(`strong`,{children:ne()}),`.`,` `,se()]}),confirmLabel:i()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(j(),e.kind)}catch(e){Z.error(re(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(f(),e.kind)}catch(e){Z.error(l(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,W.jsx)(`strong`,{children:g()}),` `,m(),` `,(0,W.jsx)(`strong`,{children:p()}),` `,he(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,ge(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:o(),timeRange:C,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:u,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:c()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:d,onValueChange:Y,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:D()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:y,onValueChange:x,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:a()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ie()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:O()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ue()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:A(),rows:$,emptyHint:u===`open`?E():le(),rowActions:e=>Fe&&e.status===`open`?[{label:pe(),onSelect:()=>void ze(e)},{label:me(),onSelect:()=>void Be(e)}]:[],columns:[{header:b(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:O(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:_(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:S(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:fe(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:de(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:T(),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:[`↗ `,y()]}):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:[`↗ `,y()]}):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:v()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:w()}):(0,W.jsx)(I,{variant:`outline`,children:x()})}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{$h as r,Bh as i,EO as a,Gh as o,Hh as s,Jh as c,Kh as l,Qh as u,Uh as ee,Vh as d,Wh as f,Xh as p,Yh as m,Zh as h,qh as g,yO as _,zh as v}from"./dist-Cxz8d8g5.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-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,EO as a,Gh as o,Hh as s,Jh as c,Kh as l,Qh as u,Uh as ee,Vh as d,Wh as f,Xh as p,Yh as m,Zh as h,qh as g,yO as _,zh as v}from"./dist-Cxz8d8g5.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-BlRMvXrJ.js";import{n as j}from"./TimeRangePicker-CFCLAlKB.js";import{t as M}from"./FilterBar-B_mSpGb-.js";import{t as N}from"./AdvancedFilter-DnGyDWXx.js";import{t as P}from"./DataTableShell-y4F1v6a9.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=a(_.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:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(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:m()}),$.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:c()}),(0,I.jsx)(k,{value:`yes`,children:g()}),(0,I.jsx)(k,{value:`no`,children:l()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:o()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:f()}),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:ee(),rows:Q,emptyHint:s(),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:i(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),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,Bu as o,CO as s,Cd as c,Dr as l,EO as u,Er as d,Fr as f,Fu as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as v,Ku as y,Lr as b,Lu as te,Mr as ne,Mu as x,Nr as re,Nu as S,Or as ie,Pr as C,Pu as ae,Qd as oe,Qu as se,Rr as ce,Ru as le,Sd as ue,Sr as de,TO as fe,Td as pe,Uu as me,Vu as he,Wu as ge,Xu as _e,Yu as ve,Zd as ye,Zu as be,_d as xe,ad as Se,bO as w,bd as Ce,cd as we,dd as Te,ed as Ee,ef as De,fd as Oe,gd as ke,hd as Ae,id as T,if as je,jr as Me,ju as E,kr as Ne,ld as Pe,md as Fe,nd as Ie,nf as Le,od as Re,of as ze,pd as Be,qd as Ve,qu as He,rd as Ue,rf as We,sd as Ge,sf as Ke,td as qe,tf as Je,ud as Ye,vd as Xe,wd as Ze,xd as Qe,yO as D,yd as $e,zr as et,zu as tt}from"./dist-Cxz8d8g5.js";import{i as O,r as nt}from"./dist-CZgL-Z5m.js";import{t as rt}from"./chevrons-up-down-Cg6ojBxr.js";import{i as it,n as k,o as at,r as ot,s as st}from"./FieldLabel-BotruMTL.js";import{t as A}from"./button-BOkPsnkZ.js";import{$ as ct,A as lt,At as j,C as M,H as ut,Q as dt,S as N,St as ft,U as pt,V as mt,X as P,Z as F,_ as ht,_t as gt,b as I,et as _t,jt as vt,kt as L,mt as R,nt as yt,ot as bt,rt as xt,x as z,y as B}from"./index-Cs-A4Qz2.js";import{a as St,i as V,n as Ct,o as H,r as U,t as wt}from"./table-XSL9PnTz.js";import{t as Tt}from"./FilterBar-BToerIZw.js";import{a as W,n as Et,o as Dt,r as Ot,s as kt,t as At}from"./compatView-CcKTaWCH.js";import{t as G}from"./dispatchErrorInfo-_T-F61vE.js";var jt=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`}]]),Mt=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`}]]),K=t(e(),1);function Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Lt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(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 Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(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 Dt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(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 qt(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 Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Dt(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Bt),[i,a]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>Kt(s),[s]),l=(0,K.useMemo)(()=>qt(s),[s]),u=(0,K.useMemo)(()=>Jt(s),[s]),d=(0,K.useMemo)(()=>Gt(Ht(s,n),i),[s,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Tt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:y(),onReset:()=>r(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:ge()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),c.map(e=>(0,Z.jsx)(z,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:me()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),l.map(e=>(0,Z.jsx)(z,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:h()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),u.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Z.jsxs)(wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(St,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:o(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:le(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:te(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:_(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:p()}),(0,Z.jsx)(Q,{label:ae(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ct,{children:d.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(nt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(rt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:v({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[He({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?S():e===`error`?x():E()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:S()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:x()}):(0,Z.jsx)(P,{variant:`outline`,children:E()})}function $t(){return u(D.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=u(D.compat.getBridgeCompat,{}),n=u(D.me.getMe,{host:bt})?.role===`admin`,r=u(D.admin.listInstances,n?{}:`skip`),i=vt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Rt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Et(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Te()}),o.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null]})}function tn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:W(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:b(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,f(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ue()});let s=Nt(e.targets),c=!e.reachable,l=Pt(e),u=l?`ok`:`error`,d=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(L,{size:22}):c?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?Ie():c?qe():Ee({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,i({time:d})]}),p?(0,Z.jsx)(`span`,{children:se({time:p})}):null,o]}),c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:At(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(gt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),f?(0,Z.jsx)(P,{variant:f===`beyond`?`destructive`:`secondary`,children:Ot(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:et()}),(0,Z.jsx)(an,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(rn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(j,{size:13,"aria-hidden":!0}),_e({count:t.length})]}),p?(0,Z.jsx)(Yt,{connections:t,displayByInstance:c}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ye(),i.length>0?(0,Z.jsx)(P,{variant:`destructive`,children:we({count:i.length})}):(0,Z.jsx)(P,{variant:`secondary`,children:Pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ge({version:e.vendoredVersion}),r?` · `+Re({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(j,{size:13,"aria-hidden":!0}),Se({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Me()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:W(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ot(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ct,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(xt,{children:Ke({instance:e.displayName??e.name})}),(0,Z.jsx)(_t,{children:ze()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(L,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ae():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Fe()]}):null}function sn({instance:e,onClose:t}){let n=fe(D.admin.upsertInstanceConfig),i=s(D.bridge.validateMediaPaths),a=lt(),[o,l]=(0,K.useState)(()=>it(e.config??{})),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await i({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error($e(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ot(o,r)}),t()}catch(e){a.error(r(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:je(),help:oe()}),(0,Z.jsxs)(B,{value:o.mediaMode,onValueChange:e=>l({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(I,{children:st.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:We(),help:ye()}),(0,Z.jsxs)(B,{value:o.inboundMediaMode,onValueChange:e=>l({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(I,{children:at.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:Le(),help:ee()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>l({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:pe(),help:Ze()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>l({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:c(),help:ue()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>l({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(ht,{checked:o.rehydration,onCheckedChange:e=>l({...o,rehydration:e===!0})}),(0,Z.jsx)(k,{label:Je(),help:Ve()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Oe({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:xe(),result:m.inbound}),(0,Z.jsx)($,{label:ke(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Be()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(ft,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ce():Qe()]}),(0,Z.jsx)(A,{size:`sm`,onClick:()=>void b(),disabled:u,children:De()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(pt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ne():ie({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on 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,Bu as o,CO as s,Cd as c,Dr as l,EO as u,Er as d,Fr as f,Fu as p,Gu as m,Hu as h,Ir as g,Iu as _,Jd as ee,Ju as v,Ku as y,Lr as b,Lu as te,Mr as ne,Mu as x,Nr as re,Nu as S,Or as ie,Pr as C,Pu as ae,Qd as oe,Qu as se,Rr as ce,Ru as le,Sd as ue,Sr as de,TO as fe,Td as pe,Uu as me,Vu as he,Wu as ge,Xu as _e,Yu as ve,Zd as ye,Zu as be,_d as xe,ad as Se,bO as w,bd as Ce,cd as we,dd as Te,ed as Ee,ef as De,fd as Oe,gd as ke,hd as Ae,id as T,if as je,jr as Me,ju as E,kr as Ne,ld as Pe,md as Fe,nd as Ie,nf as Le,od as Re,of as ze,pd as Be,qd as Ve,qu as He,rd as Ue,rf as We,sd as Ge,sf as Ke,td as qe,tf as Je,ud as Ye,vd as Xe,wd as Ze,xd as Qe,yO as D,yd as $e,zr as et,zu as tt}from"./dist-Cxz8d8g5.js";import{i as O,r as nt}from"./dist-CZgL-Z5m.js";import{t as rt}from"./chevrons-up-down-Cg6ojBxr.js";import{i as it,n as k,o as at,r as ot,s as st}from"./FieldLabel-GI9NETEt.js";import{t as A}from"./button-BOkPsnkZ.js";import{$ as ct,A as lt,At as j,C as M,H as ut,Q as dt,S as N,St as ft,U as pt,V as mt,X as P,Z as F,_ as ht,_t as gt,b as I,et as _t,jt as vt,kt as L,mt as R,nt as yt,ot as bt,rt as xt,x as z,y as B}from"./index-BlRMvXrJ.js";import{a as St,i as V,n as Ct,o as H,r as U,t as wt}from"./table-XSL9PnTz.js";import{t as Tt}from"./FilterBar-B_mSpGb-.js";import{a as W,n as Et,o as Dt,r as Ot,s as kt,t as At}from"./compatView-CcKTaWCH.js";import{t as G}from"./dispatchErrorInfo-_T-F61vE.js";var jt=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`}]]),Mt=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`}]]),K=t(e(),1);function Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Lt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(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 Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(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 Dt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(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 qt(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 Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Dt(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Bt),[i,a]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>Kt(s),[s]),l=(0,K.useMemo)(()=>qt(s),[s]),u=(0,K.useMemo)(()=>Jt(s),[s]),d=(0,K.useMemo)(()=>Gt(Ht(s,n),i),[s,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Tt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:y(),onReset:()=>r(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:ge()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),c.map(e=>(0,Z.jsx)(z,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:me()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),l.map(e=>(0,Z.jsx)(z,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:h()})}),(0,Z.jsxs)(I,{children:[(0,Z.jsx)(z,{value:J,children:m()}),u.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Z.jsxs)(wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(St,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:o(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:le(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:te(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:_(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:p()}),(0,Z.jsx)(Q,{label:ae(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ct,{children:d.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(nt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(rt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:v({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[He({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?S():e===`error`?x():E()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:S()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:x()}):(0,Z.jsx)(P,{variant:`outline`,children:E()})}function $t(){return u(D.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=u(D.compat.getBridgeCompat,{}),n=u(D.me.getMe,{host:bt})?.role===`admin`,r=u(D.admin.listInstances,n?{}:`skip`),i=vt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Rt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Et(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Te()}),o.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null]})}function tn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:W(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:b(),children:[`(`,a,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,g({build:t.buildVersion??`?`})]}):null,` · `,f(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ue()});let s=Nt(e.targets),c=!e.reachable,l=Pt(e),u=l?`ok`:`error`,d=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(L,{size:22}):c?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?Ie():c?qe():Ee({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,i({time:d})]}),p?(0,Z.jsx)(`span`,{children:se({time:p})}):null,o]}),c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:At(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(gt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),f?(0,Z.jsx)(P,{variant:f===`beyond`?`destructive`:`secondary`,children:Ot(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:et()}),(0,Z.jsx)(an,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(rn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(j,{size:13,"aria-hidden":!0}),_e({count:t.length})]}),p?(0,Z.jsx)(Yt,{connections:t,displayByInstance:c}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ye(),i.length>0?(0,Z.jsx)(P,{variant:`destructive`,children:we({count:i.length})}):(0,Z.jsx)(P,{variant:`secondary`,children:Pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ge({version:e.vendoredVersion}),r?` · `+Re({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(j,{size:13,"aria-hidden":!0}),Se({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Me()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:a({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:W(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ot(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ct,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(xt,{children:Ke({instance:e.displayName??e.name})}),(0,Z.jsx)(_t,{children:ze()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(L,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ae():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Fe()]}):null}function sn({instance:e,onClose:t}){let n=fe(D.admin.upsertInstanceConfig),i=s(D.bridge.validateMediaPaths),a=lt(),[o,l]=(0,K.useState)(()=>it(e.config??{})),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await i({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error($e(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ot(o,r)}),t()}catch(e){a.error(r(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:je(),help:oe()}),(0,Z.jsxs)(B,{value:o.mediaMode,onValueChange:e=>l({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(I,{children:st.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:We(),help:ye()}),(0,Z.jsxs)(B,{value:o.inboundMediaMode,onValueChange:e=>l({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(I,{children:at.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:Le(),help:ee()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>l({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:pe(),help:Ze()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>l({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(k,{label:c(),help:ue()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>l({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(ht,{checked:o.rehydration,onCheckedChange:e=>l({...o,rehydration:e===!0})}),(0,Z.jsx)(k,{label:Je(),help:Ve()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Oe({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:xe(),result:m.inbound}),(0,Z.jsx)($,{label:ke(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),Be()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(ft,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ce():Qe()]}),(0,Z.jsx)(A,{size:`sm`,onClick:()=>void b(),disabled:u,children:De()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(pt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ne():ie({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:l()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,CO as i,EO as a,Gr as o,Hr as s,Jr as c,KD as l,Kr as u,LS as d,Oi as f,Qr as p,S as m,TO as h,Ur as ee,Vr as te,Wr as g,Xr as _,Yr as ne,Zr as re,aa as ie,af as ae,b as v,fa as y,oa as oe,qr as b,ua as x,x as S,yO as C}from"./dist-Cxz8d8g5.js";import{t as w}from"./button-BOkPsnkZ.js";import{A as se,B as ce,C as le,F as ue,I as de,L as fe,N as pe,P as me,R as he,S as ge,Z as T,b as E,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Br as r,CO as i,EO as a,Gr as o,Hr as s,Jr as c,KD as l,Kr as u,LS as d,Oi as f,Qr as p,S as m,TO as h,Ur as ee,Vr as te,Wr as g,Xr as _,Yr as ne,Zr as re,aa as ie,af as ae,b as v,fa as y,oa as oe,qr as b,ua as x,x as S,yO as C}from"./dist-Cxz8d8g5.js";import{t as w}from"./button-BOkPsnkZ.js";import{A as se,B as ce,C as le,F as ue,I as de,L as fe,N as pe,P as me,R as he,S as ge,Z as T,b as E,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-BlRMvXrJ.js";import{i as P}from"./compatView-CcKTaWCH.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=h(C.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[a,s]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,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:m()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(T,{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)(w,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?y():u()})]}),d?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),a===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):null,a===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function z(){let e=i(C.agentFiles.getChatDefaults),t=i(C.agentFiles.setChatDefaults),n=se(),[m,h]=(0,F.useState)({status:`loading`}),[v,S]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[T,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=a(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=a(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;h({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;h({status:`done`,current:n}),S(n)}catch{if(Y.current!==t)return;h({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=m.status===`done`?m.current:null,Q=Z!==null&&v.thinkingDefault!==null&&v.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&v.fastModeDefault!==null&&v.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:v.thinkingDefault}:{},...$?{fastModeDefault:v.fastModeDefault}:{}}),n.success(o()),await X()}catch(e){n.error(g(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:D(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:oe()},{id:`standard`,label:ie()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(ge,{size:`sm`,"aria-label":f(),children:(0,R.jsx)(le,{})}),(0,R.jsx)(E,{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:ae()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):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)]}):m.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):m.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[b(),` `,(0,R.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:x()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:re()}),(0,R.jsx)(O,{options:Se,value:v.thinkingDefault,onChange:e=>S({...v,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,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:Ce,value:v.fastModeDefault===null?null:v.fastModeDefault?`fast`:`standard`,onChange:e=>S({...v,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(w,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?y():u()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:ee()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(pe,{open:T,onOpenChange:z,children:(0,R.jsxs)(de,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(ce,{children:s()}),(0,R.jsx)(fe,{children:te()})]}),(0,R.jsxs)(he,{children:[(0,R.jsx)(ue,{children:d()}),(0,R.jsx)(me,{onClick:()=>void xe(),children:r()})]})]})})]})}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-Cxz8d8g5.js";import{i as u,r as d}from"./dist-CZgL-Z5m.js";import{t as f}from"./chevrons-up-down-Cg6ojBxr.js";import{t as p}from"./button-BOkPsnkZ.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-
|
|
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-Cxz8d8g5.js";import{i as u,r as d}from"./dist-CZgL-Z5m.js";import{t as f}from"./chevrons-up-down-Cg6ojBxr.js";import{t as p}from"./button-BOkPsnkZ.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-BlRMvXrJ.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-XSL9PnTz.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-BlRMvXrJ.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};
|
|
@@ -1 +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,EO as c,Ev as l,Fv as u,Gv as d,Hv as f,Iv as p,Jv as m,Kv as h,Lv as g,Mv as _,Nv as ee,Ov as te,Pv as v,Qv as y,Rv as ne,Sv as re,TO as b,Tv as ie,Uv as ae,Vv as x,Wv as S,Xv as C,Yv as w,Zv as T,_v as E,ay as D,bv as O,cy as k,dy as A,ey as j,fy as M,gv as N,hv as P,hy as F,iy as I,jv as L,kv as R,ly as z,mv as B,my as oe,ny as V,oy as H,py as U,qv as W,ry as G,sy as K,ty as q,uy as se,vv as ce,wv as le,xv as ue,yO as J,yv as de,zv as fe}from"./dist-Cxz8d8g5.js";import{t as pe}from"./button-BOkPsnkZ.js";import{j as me}from"./index-
|
|
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,EO as c,Ev as l,Fv as u,Gv as d,Hv as f,Iv as p,Jv as m,Kv as h,Lv as g,Mv as _,Nv as ee,Ov as te,Pv as v,Qv as y,Rv as ne,Sv as re,TO as b,Tv as ie,Uv as ae,Vv as x,Wv as S,Xv as C,Yv as w,Zv as T,_v as E,ay as D,bv as O,cy as k,dy as A,ey as j,fy as M,gv as N,hv as P,hy as F,iy as I,jv as L,kv as R,ly as z,mv as B,my as oe,ny as V,oy as H,py as U,qv as W,ry as G,sy as K,ty as q,uy as se,vv as ce,wv as le,xv as ue,yO as J,yv as de,zv as fe}from"./dist-Cxz8d8g5.js";import{t as pe}from"./button-BOkPsnkZ.js";import{j as me}from"./index-BlRMvXrJ.js";import{t as he}from"./DataTableShell-y4F1v6a9.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>F(),incorrect:()=>oe(),incoherence:()=>U(),formatting:()=>M(),latency:()=>A(),api_error:()=>se(),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:K()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:H()}):(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,i=b(J.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[u,p]=(0,Y.useState)(!1);async function g(){let t=c.trim();if(!(!t||u)){p(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{p(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}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?` · ${D()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(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:O()}),(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:G()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?V():q()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:j()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:r(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 g(),disabled:!c.trim()||u,children:u?y():T()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||w()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||w()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h({count:n.contextCount??_.length,truncated:n.contextTruncated?d():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.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:S()}),(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:ae()}),(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:f()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?x({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:[a(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,fe()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=c(J.feedback.listForAdmin,{}),t=b(J.feedback.readSnapshot),n=b(J.feedback.deleteFeedback),r=me(),[a,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)({});async function h(e){if(a===e._id){d(null);return}if(!f[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}d(e._id)}async function y(e){await r({title:N(),description:P(),confirmLabel:B(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&d(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,X.jsx)(`strong`,{children:g()}),` `,p()]}),(0,X.jsx)(he,{title:u(),rows:e,emptyHint:v(),isExpanded:e=>a===e._id&&!!f[e._id],renderExpanded:e=>f[e._id]?(0,X.jsx)(ge,{data:f[e._id],closeReason:e.userCloseReason}):null,columns:[{header:ee(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:_(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:L(),cell:e=>e.messageRole===`user`?i():R(),sort:e=>e.messageRole},{header:te(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${s({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:l(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ie(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:le(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:o()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ue()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?de():ce(),onSelect:()=>void h(e)},{label:E(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{NO as t,bO as n}from"./dist-Cxz8d8g5.js";import{c as r,l as i,s as a,u as o}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{NO as t,bO as n}from"./dist-Cxz8d8g5.js";import{c as r,l as i,s as a,u as o}from"./index-BlRMvXrJ.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]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as ee,CD as te,EO as ne,GE as re,JD as ie,JE as ae,KD as oe,KE as r,LS as i,QE as a,SD as o,TO as s,UE as c,WE as l,XE as u,YE as se,ZE as d,_D as ce,aD as le,bD as f,cD as p,dD as m,eD as ue,fD as h,gD as de,hD as fe,iD as pe,lD as g,mD as me,nD as he,oD as ge,pD as _,qE as _e,rD as ve,sD as v,tD as y,uD as b,vD as x,wD as S,xD as C,yD as w,yO as T}from"./dist-Cxz8d8g5.js";import{t as E}from"./button-BOkPsnkZ.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,Tt as Se,W as Ce,X as we,Y as Te,b as L,ht as Ee,x as R,y as z,yt as De,z as Oe}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as ee,CD as te,EO as ne,GE as re,JD as ie,JE as ae,KD as oe,KE as r,LS as i,QE as a,SD as o,TO as s,UE as c,WE as l,XE as u,YE as se,ZE as d,_D as ce,aD as le,bD as f,cD as p,dD as m,eD as ue,fD as h,gD as de,hD as fe,iD as pe,lD as g,mD as me,nD as he,oD as ge,pD as _,qE as _e,rD as ve,sD as v,tD as y,uD as b,vD as x,wD as S,xD as C,yD as w,yO as T}from"./dist-Cxz8d8g5.js";import{t as E}from"./button-BOkPsnkZ.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,Tt as Se,W as Ce,X as we,Y as Te,b as L,ht as Ee,x as R,y as z,yt as De,z as Oe}from"./index-BlRMvXrJ.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-XSL9PnTz.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return _();case`audio`:return h();case`video`:return m();case`pdf`:return b();case`document`:return g();case`archive`:return p();default:return v()}}function q(){let[e,t]=(0,U.useState)(G),[n,p]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[v,b]=(0,U.useState)(null),q=s(T.files.softDelete),J=D();function Me(){t(G),p(G),h(G),_(G)}async function Ne(){let e=v;if(b(null),e)try{await q({fileId:e.id}),J.success(u())}catch(e){J.error(se(),e)}}let Y=ne(T.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:m===G?void 0:m,category:g===G?void 0:g}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ie(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:oe()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||m!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":te(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:o()}),(0,W.jsx)(R,{value:`inbound`,children:C()}),(0,W.jsx)(R,{value:`outbound`,children:f()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:p,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":w(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:x()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:m,onValueChange:h,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:de()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:g,onValueChange:_,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:me()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ee()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():re()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:ge()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{children:ve()}),(0,W.jsx)(B,{children:he()}),(0,W.jsx)(B,{className:`text-right`,children:y()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?C():f()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ce,{children:[(0,W.jsx)(Te,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":a(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),ue()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),r()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>b({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),d()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:c({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:v!==null,onOpenChange:e=>!e&&b(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:ae()}),(0,W.jsx)(F,{children:_e()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:i()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:d()})]})]})})]})}export{q 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-Cxz8d8g5.js";import{t as a}from"./button-BOkPsnkZ.js";import{Z as o,vt as s,yt as c}from"./index-
|
|
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-Cxz8d8g5.js";import{t as a}from"./button-BOkPsnkZ.js";import{Z as o,vt as s,yt as c}from"./index-BlRMvXrJ.js";import{t as l}from"./TimeRangePicker-CFCLAlKB.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};
|
|
@@ -1 +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,EO as u,Ea as d,Eo as f,Fa as p,Ga as m,Ha as h,Ia as g,Ja as _,Ka as v,La as y,Ma as b,Mo as x,Na as S,No as ee,Oa as C,Oo as w,Pa as T,Qa as E,Ra as D,So as te,TO as O,Ta as k,To as ne,Ua as A,Va as j,Wa as re,Xa as M,Ya as N,Za as ie,_o as P,ao as ae,bO as F,bo as I,co as oe,do as se,eo as L,fo as ce,go as le,ho as ue,io as R,ja as de,jo as fe,ka as pe,ko as me,lo as he,mo as ge,no as _e,oo as ve,po as ye,qa as be,ro as xe,so as Se,to as Ce,uo as we,vo as Te,wa as Ee,wo as De,xo as Oe,yO as z,yo as ke,za as Ae}from"./dist-Cxz8d8g5.js";import{t as je}from"./x-BimfpZdd.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CVbQ8jlY.js";import{t as H}from"./button-BOkPsnkZ.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-Cs-A4Qz2.js";import{t as Je}from"./FilterBar-BToerIZw.js";import{t as Ye}from"./DataTableShell-_imgfnfL.js";import{t as Y}from"./DetailChips-WfEcflRX.js";var Xe=F(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=F(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=F(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=F(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return L();case`user`:return r();case`pending`:return E();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=u(z.groups.listGroups,{}),t=u(z.me.getMe,{host:We})?.role===`admin`,n=O(z.groups.createGroup),r=O(z.groups.updateGroup),i=O(z.groups.deleteGroup),o=Ve(),p=U(),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)($),[b,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function D(){_(null),y($),h(!0)}function k(e){_(e),y({name:e.name,description:e.description??``}),h(!0)}async function A(){try{g?await r({groupId:g._id,name:v.name,description:v.description}):await n({name:v.name,description:v.description||void 0}),y($),_(null),h(!1)}catch(e){p.error(c(),e)}}async function j(e){if(await o({title:ge({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:ce(),cancelLabel:I(),destructive:!0}))try{await i({groupId:e._id})}catch(e){p.error(d(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,Q.jsx)(Je,{q:C,onQChange:T,onReset:()=>T(``),canReset:C!==``,searchPlaceholder:ne()}),(0,Q.jsx)(Ye,{title:ee(),rows:E,addLabel:fe(),onAdd:t?D:void 0,emptyHint:a(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:f(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>S({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>k(e)},{label:te(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(He,{open:m,onOpenChange:h,title:g?Te():ke(),description:P(),canSubmit:!!v.name.trim(),onSubmit:A,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:le()}),(0,Q.jsx)(G,{value:v.name,onChange:e=>y({...v,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(G,{value:v.description,onChange:e=>y({...v,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:b?.groupId??null,groupName:b?.name??``,open:b!==null,onOpenChange:e=>{e||S(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),xe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_e(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=u(z.groups.getGroup,n&&e?{groupId:e}:`skip`),s=u(z.groups.listAssignableInstances,n?{}:`skip`),c=u(z.groups.listAssignableUsers,n?{}:`skip`),l=O(z.groups.addMember),d=O(z.groups.removeMember),f=O(z.groups.bulkSetMembers),p=O(z.groups.setGroupManager),m=U(),[h,g]=(0,Z.useState)(``),[_,y]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[ee,C]=(0,Z.useState)(1),[w,T]=(0,Z.useState)(new Set),E=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{g(``),y(``),S(`members`),C(1),E.current=null},[n,e]),(0,Z.useEffect)(()=>{C(1)},[h]),(0,Z.useEffect)(()=>{n&&a&&e&&E.current!==e&&(E.current=e,T(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>c?$e(c,h,w):[],[c,h,w]);async function re(t,n){if(e)try{n?await d({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){m.error(k(),e)}}async function M(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(pe(),e)}}let P=rt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,I=it(j,ee,ot);async function L(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){m.error(k(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:se({name:t})}),(0,Q.jsx)(Be,{children:we()})]}),(0,Q.jsxs)(Ne,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),he(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Se(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:h,onChange:e=>g(e.target.value),placeholder:oe(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void L(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void re(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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():de(),title:r?i():de(),onClick:()=>void M(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":b(),title:b(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:C})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>y(e.target.value),placeholder:ve(),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:A,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=u(z.groups.listAssignableAgents,{instanceName:t}),o=O(z.groups.assignAgentToGroup),s=O(z.groups.removeAgentFromGroup),c=O(z.groups.bulkSetGroupAgents),l=U(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let v=p.filter(e=>e.presentInLastOk!==!1),y=rt(v,e=>r.has(`${t}/${e.agentId}`)),b=it(p,d,ot);async function x(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ee(),e)}}async function S(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){l.error(Ee(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:A()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?re():m()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.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)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":M({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":j(),title:j(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:h()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=u(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=O(z.charts.assignChartToGroup),r=O(z.charts.removeChartFromGroup),i=O(z.charts.setGroupDefaultChart),a=O(z.charts.addChartToGroupPool),o=O(z.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(C(),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)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":p({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":T(),title:T(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:S()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":g({name:e.name}),title:g({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:y()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):null:null]})}export{at as GroupsTab};
|
|
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,EO as u,Ea as d,Eo as f,Fa as p,Ga as m,Ha as h,Ia as g,Ja as _,Ka as v,La as y,Ma as b,Mo as x,Na as S,No as ee,Oa as C,Oo as w,Pa as T,Qa as E,Ra as D,So as te,TO as O,Ta as k,To as ne,Ua as A,Va as j,Wa as re,Xa as M,Ya as N,Za as ie,_o as P,ao as ae,bO as F,bo as I,co as oe,do as se,eo as L,fo as ce,go as le,ho as ue,io as R,ja as de,jo as fe,ka as pe,ko as me,lo as he,mo as ge,no as _e,oo as ve,po as ye,qa as be,ro as xe,so as Se,to as Ce,uo as we,vo as Te,wa as Ee,wo as De,xo as Oe,yO as z,yo as ke,za as Ae}from"./dist-Cxz8d8g5.js";import{t as je}from"./x-BimfpZdd.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-DT8VXxMj.js";import{t as H}from"./button-BOkPsnkZ.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-BlRMvXrJ.js";import{t as Je}from"./FilterBar-B_mSpGb-.js";import{t as Ye}from"./DataTableShell-y4F1v6a9.js";import{t as Y}from"./DetailChips-BFrPLaU7.js";var Xe=F(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=F(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=F(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=F(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return L();case`user`:return r();case`pending`:return E();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=u(z.groups.listGroups,{}),t=u(z.me.getMe,{host:We})?.role===`admin`,n=O(z.groups.createGroup),r=O(z.groups.updateGroup),i=O(z.groups.deleteGroup),o=Ve(),p=U(),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)($),[b,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function D(){_(null),y($),h(!0)}function k(e){_(e),y({name:e.name,description:e.description??``}),h(!0)}async function A(){try{g?await r({groupId:g._id,name:v.name,description:v.description}):await n({name:v.name,description:v.description||void 0}),y($),_(null),h(!1)}catch(e){p.error(c(),e)}}async function j(e){if(await o({title:ge({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:ce(),cancelLabel:I(),destructive:!0}))try{await i({groupId:e._id})}catch(e){p.error(d(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,Q.jsx)(Je,{q:C,onQChange:T,onReset:()=>T(``),canReset:C!==``,searchPlaceholder:ne()}),(0,Q.jsx)(Ye,{title:ee(),rows:E,addLabel:fe(),onAdd:t?D:void 0,emptyHint:a(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:f(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>S({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>k(e)},{label:te(),variant:`destructive`,onSelect:()=>void j(e)}]:[]]}),(0,Q.jsx)(He,{open:m,onOpenChange:h,title:g?Te():ke(),description:P(),canSubmit:!!v.name.trim(),onSubmit:A,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:le()}),(0,Q.jsx)(G,{value:v.name,onChange:e=>y({...v,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(G,{value:v.description,onChange:e=>y({...v,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:b?.groupId??null,groupName:b?.name??``,open:b!==null,onOpenChange:e=>{e||S(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),xe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_e(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=u(z.groups.getGroup,n&&e?{groupId:e}:`skip`),s=u(z.groups.listAssignableInstances,n?{}:`skip`),c=u(z.groups.listAssignableUsers,n?{}:`skip`),l=O(z.groups.addMember),d=O(z.groups.removeMember),f=O(z.groups.bulkSetMembers),p=O(z.groups.setGroupManager),m=U(),[h,g]=(0,Z.useState)(``),[_,y]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[ee,C]=(0,Z.useState)(1),[w,T]=(0,Z.useState)(new Set),E=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{g(``),y(``),S(`members`),C(1),E.current=null},[n,e]),(0,Z.useEffect)(()=>{C(1)},[h]),(0,Z.useEffect)(()=>{n&&a&&e&&E.current!==e&&(E.current=e,T(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>c?$e(c,h,w):[],[c,h,w]);async function re(t,n){if(e)try{n?await d({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){m.error(k(),e)}}async function M(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(pe(),e)}}let P=rt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,I=it(j,ee,ot);async function L(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){m.error(k(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:se({name:t})}),(0,Q.jsx)(Be,{children:we()})]}),(0,Q.jsxs)(Ne,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),he(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Se(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:h,onChange:e=>g(e.target.value),placeholder:oe(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void L(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void re(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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():de(),title:r?i():de(),onClick:()=>void M(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":b(),title:b(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:C})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>y(e.target.value),placeholder:ve(),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:A,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=u(z.groups.listAssignableAgents,{instanceName:t}),o=O(z.groups.assignAgentToGroup),s=O(z.groups.removeAgentFromGroup),c=O(z.groups.bulkSetGroupAgents),l=U(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let v=p.filter(e=>e.presentInLastOk!==!1),y=rt(v,e=>r.has(`${t}/${e.agentId}`)),b=it(p,d,ot);async function x(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ee(),e)}}async function S(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){l.error(Ee(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:A()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?re():m()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.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)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":M({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":j(),title:j(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:h()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=u(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=O(z.charts.assignChartToGroup),r=O(z.charts.removeChartFromGroup),i=O(z.charts.setGroupDefaultChart),a=O(z.charts.addChartToGroupPool),o=O(z.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(C(),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)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":p({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":T(),title:T(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:S()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":g({name:e.name}),title:g({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:y()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,A_ as i,Ag as a,B_ as o,Bg as s,CO as c,C_ as l,Cg as u,DC as d,D_ as f,Dg as p,EC as m,EO as h,E_ as g,Eg as _,F_ as v,Fg as y,Gg as b,Hg as x,I_ as S,Ig as C,Jg as w,Kg as T,L as E,L_ as ee,Lg as D,M_ as O,Mg as te,N_ as ne,Ng as re,O_ as ie,Og as ae,P_ as oe,Pg as se,Qg as ce,R as le,R_ as ue,Rg as de,S_ as fe,Sg as pe,TO as k,T_ as me,Tg as he,Ug as ge,Vg as _e,Wg as ve,Xd as ye,Xg as be,Yd as xe,Yg as Se,Zg as Ce,__ as we,_g as Te,a_ as Ee,ag as De,b_ as Oe,bg as ke,c_ as Ae,cg as je,d_ as Me,dg as Ne,e_ as Pe,eg as Fe,f_ as Ie,fg as Le,g_ as Re,gg as ze,h_ as Be,hg as Ve,i_ as He,ig as Ue,j_ as We,jg as Ge,k_ as Ke,kg as qe,l_ as Je,lg as Ye,m_ as Xe,mg as Ze,n_ as A,ng as Qe,o_ as $e,og as et,p_ as tt,pg as nt,qg as rt,r_ as j,rg as it,s_ as at,sg as ot,t_ as st,tg as M,u_ as ct,ug as lt,v_ as ut,vg as dt,w_ as ft,wg as N,x_ as pt,xg as P,yO as F,y_ as mt,yg as ht,z_ as gt,zg as _t}from"./dist-Cxz8d8g5.js";import{a as vt,c as yt}from"./FieldLabel-BotruMTL.js";import{t as I}from"./button-BOkPsnkZ.js";import{$ as bt,A as L,C as xt,H as St,Q as R,S as z,U as Ct,V as wt,X as B,Z as V,_ as H,b as U,et as W,j as Tt,m as Et,nt as G,rt as K,x as q,y as J}from"./index-Cs-A4Qz2.js";import{t as Dt}from"./DataTableShell-_imgfnfL.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-DM0F3JBU.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:vt},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=h(F.admin.listInstances,{}),t=h(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),r=k(F.admin.deleteInstance),a=L(),[s,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),w(null),c(!1)}catch(e){a.error(ue(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),(0,Z.jsx)(`strong`,{children:S()}),v()]}),(0,Z.jsx)(Dt,{title:oe(),rows:e,addLabel:ne(),onAdd:()=>{w(null),d(Q),c(!0)},emptyHint:O(),columns:[{header:We(),cell:e=>e.name,sort:e=>e.name},{header:i(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ke(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ie(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:o(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?M():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ft(),onSelect:()=>{w(e._id),d(Nt(e)),c(!0)}},{label:gt(),onSelect:()=>m(e.name)},{label:Je(),onSelect:()=>x(e)},{label:f(),onSelect:()=>y(e)},{label:g(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:g(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Et,{open:s,onOpenChange:c,title:C?l():me(),description:pt(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:T,submitLabel:Oe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:mt(),children:[(0,Z.jsx)(V,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:fe()}):null]}),(0,Z.jsx)($,{label:ut(),children:(0,Z.jsxs)(J,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(xt,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(V,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Re(),children:(0,Z.jsx)(V,{value:u.bridgeUrl,placeholder:Be(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(V,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ye(),children:[(0,Z.jsxs)(J,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(xt,{})}),(0,Z.jsx)(U,{children:yt.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xe()})]}),(0,Z.jsx)($,{label:tt(),children:(0,Z.jsx)(V,{value:u.gatewayVersion,placeholder:Ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(V,{value:u.gatewayHttpUrl,placeholder:ct(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),_?(0,Z.jsx)(Ot,{instance:_,onClose:()=>y(null)},_._id):null,b?(0,Z.jsx)(Ft,{instance:b,onClose:()=>x(null)},b._id):null]})}function Ft({instance:e,onClose:t}){let n=h(F.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)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(bt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Ae({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:at()})]}),(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=c(F.instanceSync.forceInstanceSync),n=L(),[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(_e());break;case`no_agents`:n.success(_t());break;case`no_bridge_url`:n.error(de());break;case`deploy_misconfigured`:n.error(D());break;case`unauthorized`:n.error(y());break;case`not_served`:n.error(se());break;default:n.error(C());break}}catch(e){n.error(s(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?x():ge()})})]})}function Lt({instance:e}){let t=h(F.bridgeAuth.listBridgeAuthStatus,{}),n=c(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=L(),[o,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[f,g]=(0,Y.useState)(!1),v=(t??[]).find(t=>t.instanceId===e._id),y=v!==void 0;async function b(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),g(!1)}catch(e){i.error(_(),e)}finally{s(!1)}}}async function x(){if(!o){s(!0);try{await r({instanceId:e._id}),u(null),i.success(p())}catch(e){i.error(_(),e)}finally{s(!1)}}}async function S(){if(l)try{await navigator.clipboard.writeText(l),g(!0)}catch{}}return(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:y?`outline`:`secondary`,children:y?`${j()} · ${v.prefix}…${v.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void b(),disabled:o,children:y?qe():a()}),y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:o,children:ae()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:he()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:f?d():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),g(!1)},children:N()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=c(F.instanceSecrets.setInstanceSecret),a=k(F.instanceSecrets.clearInstanceSecret),o=c(F.deviceIdentity.generateDeviceIdentity),s=L(),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),y=n!==null,x=t===`deviceIdentity`,S=t===`token`?$e():t===`deviceIdentity`?Ee():He();async function C(){if(!(!l.trim()||f)){p(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),g(null),v(!1),s.success(Ce())}catch(e){s.error(be(),e)}finally{p(!1)}}}async function E(){if(!f){p(!0);try{await a({instanceId:e,field:t}),g(null),v(!1),s.success(Se())}catch(e){s.error(be(),e)}finally{p(!1)}}}async function ee(){if(!f){p(!0);try{g(await o({instanceId:e})),v(!1),s.success(T())}catch(e){s.error(ve(),e)}finally{p(!1)}}}let D=h?`openclaw devices approve ${h.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),v(!0)}catch{}}return(0,Z.jsxs)($,{label:S,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:y?`outline`:`secondary`,children:y?j():A()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:y?Pe():st(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:f||l.trim().length===0,children:r()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:f,children:w()}):null,y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:f,children:ce()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:T()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:_?d():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),v(!1)},children:N()})]}):null]})}var zt={conversational:ze,documentary:Ze,summarizer:le},Bt={conversational:Ve,documentary:nt,summarizer:E},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:ke()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(St,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:dt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Te()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(H,{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=h(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=k(F.agents.removeInstanceAgent),c=Tt(),l=L();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){l.error(P(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){l.error(P(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){l.error(P(),e)}}async function m(t,n){if(e&&await c({title:lt({name:n}),description:Ye(),confirmLabel:je(),destructive:!0}))try{await s({instanceName:e,agentId:t}),l.success(ot())}catch(e){l.error(P(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(bt,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:u({name:e??``})}),(0,Z.jsx)(W,{children:pe()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?De():r.discovery.lastPollOk?Ue():it({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Qe()}):(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)(H,{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)(B,{variant:`outline`,className:`oc-access__gone`,children:Fe()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:Ne()})]}):n?(0,Z.jsx)(B,{variant:`default`,children:M()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Le()})]}),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};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,A_ as i,Ag as a,B_ as o,Bg as s,CO as c,C_ as l,Cg as u,DC as d,D_ as f,Dg as p,EC as m,EO as h,E_ as g,Eg as _,F_ as v,Fg as y,Gg as b,Hg as x,I_ as S,Ig as C,Jg as w,Kg as T,L as E,L_ as ee,Lg as D,M_ as O,Mg as te,N_ as ne,Ng as re,O_ as ie,Og as ae,P_ as oe,Pg as se,Qg as ce,R as le,R_ as ue,Rg as de,S_ as fe,Sg as pe,TO as k,T_ as me,Tg as he,Ug as ge,Vg as _e,Wg as ve,Xd as ye,Xg as be,Yd as xe,Yg as Se,Zg as Ce,__ as we,_g as Te,a_ as Ee,ag as De,b_ as Oe,bg as ke,c_ as Ae,cg as je,d_ as Me,dg as Ne,e_ as Pe,eg as Fe,f_ as Ie,fg as Le,g_ as Re,gg as ze,h_ as Be,hg as Ve,i_ as He,ig as Ue,j_ as We,jg as Ge,k_ as Ke,kg as qe,l_ as Je,lg as Ye,m_ as Xe,mg as Ze,n_ as A,ng as Qe,o_ as $e,og as et,p_ as tt,pg as nt,qg as rt,r_ as j,rg as it,s_ as at,sg as ot,t_ as st,tg as M,u_ as ct,ug as lt,v_ as ut,vg as dt,w_ as ft,wg as N,x_ as pt,xg as P,yO as F,y_ as mt,yg as ht,z_ as gt,zg as _t}from"./dist-Cxz8d8g5.js";import{a as vt,c as yt}from"./FieldLabel-GI9NETEt.js";import{t as I}from"./button-BOkPsnkZ.js";import{$ as bt,A as L,C as xt,H as St,Q as R,S as z,U as Ct,V as wt,X as B,Z as V,_ as H,b as U,et as W,j as Tt,m as Et,nt as G,rt as K,x as q,y as J}from"./index-BlRMvXrJ.js";import{t as Dt}from"./DataTableShell-y4F1v6a9.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-Bba1_oYY.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:vt},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=h(F.admin.listInstances,{}),t=h(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),r=k(F.admin.deleteInstance),a=L(),[s,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),w(null),c(!1)}catch(e){a.error(ue(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),(0,Z.jsx)(`strong`,{children:S()}),v()]}),(0,Z.jsx)(Dt,{title:oe(),rows:e,addLabel:ne(),onAdd:()=>{w(null),d(Q),c(!0)},emptyHint:O(),columns:[{header:We(),cell:e=>e.name,sort:e=>e.name},{header:i(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ke(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ie(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:o(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?M():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ft(),onSelect:()=>{w(e._id),d(Nt(e)),c(!0)}},{label:gt(),onSelect:()=>m(e.name)},{label:Je(),onSelect:()=>x(e)},{label:f(),onSelect:()=>y(e)},{label:g(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:g(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Et,{open:s,onOpenChange:c,title:C?l():me(),description:pt(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:T,submitLabel:Oe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:mt(),children:[(0,Z.jsx)(V,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:fe()}):null]}),(0,Z.jsx)($,{label:ut(),children:(0,Z.jsxs)(J,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(xt,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(V,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Re(),children:(0,Z.jsx)(V,{value:u.bridgeUrl,placeholder:Be(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(V,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ye(),children:[(0,Z.jsxs)(J,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(xt,{})}),(0,Z.jsx)(U,{children:yt.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xe()})]}),(0,Z.jsx)($,{label:tt(),children:(0,Z.jsx)(V,{value:u.gatewayVersion,placeholder:Ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(V,{value:u.gatewayHttpUrl,placeholder:ct(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),_?(0,Z.jsx)(Ot,{instance:_,onClose:()=>y(null)},_._id):null,b?(0,Z.jsx)(Ft,{instance:b,onClose:()=>x(null)},b._id):null]})}function Ft({instance:e,onClose:t}){let n=h(F.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)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(bt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Ae({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:at()})]}),(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=c(F.instanceSync.forceInstanceSync),n=L(),[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(_e());break;case`no_agents`:n.success(_t());break;case`no_bridge_url`:n.error(de());break;case`deploy_misconfigured`:n.error(D());break;case`unauthorized`:n.error(y());break;case`not_served`:n.error(se());break;default:n.error(C());break}}catch(e){n.error(s(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?x():ge()})})]})}function Lt({instance:e}){let t=h(F.bridgeAuth.listBridgeAuthStatus,{}),n=c(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=L(),[o,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[f,g]=(0,Y.useState)(!1),v=(t??[]).find(t=>t.instanceId===e._id),y=v!==void 0;async function b(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),g(!1)}catch(e){i.error(_(),e)}finally{s(!1)}}}async function x(){if(!o){s(!0);try{await r({instanceId:e._id}),u(null),i.success(p())}catch(e){i.error(_(),e)}finally{s(!1)}}}async function S(){if(l)try{await navigator.clipboard.writeText(l),g(!0)}catch{}}return(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:y?`outline`:`secondary`,children:y?`${j()} · ${v.prefix}…${v.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void b(),disabled:o,children:y?qe():a()}),y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:o,children:ae()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:he()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:f?d():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),g(!1)},children:N()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let i=c(F.instanceSecrets.setInstanceSecret),a=k(F.instanceSecrets.clearInstanceSecret),o=c(F.deviceIdentity.generateDeviceIdentity),s=L(),[l,u]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),y=n!==null,x=t===`deviceIdentity`,S=t===`token`?$e():t===`deviceIdentity`?Ee():He();async function C(){if(!(!l.trim()||f)){p(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),g(null),v(!1),s.success(Ce())}catch(e){s.error(be(),e)}finally{p(!1)}}}async function E(){if(!f){p(!0);try{await a({instanceId:e,field:t}),g(null),v(!1),s.success(Se())}catch(e){s.error(be(),e)}finally{p(!1)}}}async function ee(){if(!f){p(!0);try{g(await o({instanceId:e})),v(!1),s.success(T())}catch(e){s.error(ve(),e)}finally{p(!1)}}}let D=h?`openclaw devices approve ${h.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),v(!0)}catch{}}return(0,Z.jsxs)($,{label:S,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:y?`outline`:`secondary`,children:y?j():A()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:y?Pe():st(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:f||l.trim().length===0,children:r()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:f,children:w()}):null,y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:f,children:ce()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:T()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:_?d():m()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),v(!1)},children:N()})]}):null]})}var zt={conversational:ze,documentary:Ze,summarizer:le},Bt={conversational:Ve,documentary:nt,summarizer:E},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:ke()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(St,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:dt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Te()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(H,{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=h(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=k(F.agents.removeInstanceAgent),c=Tt(),l=L();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){l.error(P(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){l.error(P(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){l.error(P(),e)}}async function m(t,n){if(e&&await c({title:lt({name:n}),description:Ye(),confirmLabel:je(),destructive:!0}))try{await s({instanceName:e,agentId:t}),l.success(ot())}catch(e){l.error(P(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(bt,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:u({name:e??``})}),(0,Z.jsx)(W,{children:pe()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?De():r.discovery.lastPollOk?Ue():it({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Qe()}):(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)(H,{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)(B,{variant:`outline`,className:`oc-access__gone`,children:Fe()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:Ne()})]}):n?(0,Z.jsx)(B,{variant:`default`,children:M()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Le()})]}),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};
|
|
@@ -1 +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,CO as s,Cy as c,Dy as l,EO as u,Ey as d,Fy as ee,Gy as f,Hy as te,Iy as ne,Jy as p,Ky as re,Ly as m,My as ie,Ny as h,Oy as ae,Py as g,Qt as _,Qy as v,Ry as y,Sy as oe,TO as b,Ty as se,Uy as ce,Vy as le,Wy as ue,Xy as de,Yy as x,Zt as S,Zy as C,_y as w,ab as T,an as E,by as D,cb as O,eb as k,en as A,gy as j,ib as M,in as N,jy as P,ky as F,nb as I,nn as L,ob as R,qy as z,rb as B,rn as V,sb as H,tb as U,tn as fe,vy as pe,wy as me,xy as he,yO as W,yy as ge,zy as _e}from"./dist-Cxz8d8g5.js";import{t as G}from"./button-BOkPsnkZ.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-
|
|
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,CO as s,Cy as c,Dy as l,EO as u,Ey as d,Fy as ee,Gy as f,Hy as te,Iy as ne,Jy as p,Ky as re,Ly as m,My as ie,Ny as h,Oy as ae,Py as g,Qt as _,Qy as v,Ry as y,Sy as oe,TO as b,Ty as se,Uy as ce,Vy as le,Wy as ue,Xy as de,Yy as x,Zt as S,Zy as C,_y as w,ab as T,an as E,by as D,cb as O,eb as k,en as A,gy as j,ib as M,in as N,jy as P,ky as F,nb as I,nn as L,ob as R,qy as z,rb as B,rn as V,sb as H,tb as U,tn as fe,vy as pe,wy as me,xy as he,yO as W,yy as ge,zy as _e}from"./dist-Cxz8d8g5.js";import{t as G}from"./button-BOkPsnkZ.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-BlRMvXrJ.js";import{t as we}from"./DataTableShell-y4F1v6a9.js";var J=t(e(),1),Y=n();function Te(){let e=u(W.integrations.status.status,{}),t=b(W.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:O()});let s=n,_=(e,t,n)=>r({...s,[e]:{...s[e],[t]:n}}),S=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[H(),` `,(0,Y.jsx)(`strong`,{children:R()}),` `,T()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:M()}):(0,Y.jsx)(K,{variant:`outline`,children:B()}):(0,Y.jsx)(K,{variant:`outline`,children:I()}),note:k(),children:[(0,Y.jsx)(Z,{label:v(),children:(0,Y.jsx)(q,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>_(`langfuse`,`host`,e.target.value),onBlur:()=>S(`langfuse`,{host:s.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:p(),checked:s.langfuse.enabled??!0,onChange:e=>{_(`langfuse`,`enabled`,e),S(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:M()}):(0,Y.jsx)(K,{variant:`outline`,children:B()}):(0,Y.jsx)(K,{variant:`outline`,children:I()}),note:i(),children:[(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)(q,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>_(`opik`,`baseUrl`,e.target.value),onBlur:()=>S(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:de(),children:(0,Y.jsx)(q,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>_(`opik`,`workspace`,e.target.value),onBlur:()=>S(`opik`,{workspace:s.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:p(),checked:s.opik.enabled??!0,onChange:e=>{_(`opik`,`enabled`,e),S(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:M()}):(0,Y.jsx)(K,{variant:`outline`,children:B()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}),note:N(),children:[(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(q,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>_(`otlp`,`endpoint`,e.target.value),onBlur:()=>S(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:p(),checked:s.otlp.enabled??!0,onChange:e=>{_(`otlp`,`enabled`,e),S(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:z(),status:(0,Y.jsx)(K,{variant:`outline`,children:U()}),note:re(),children:[(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)($,{value:s.tts.auto??`off`,options:[[`off`,ue()],[`always`,ce()],[`inbound`,te()],[`tagged`,le()]],onChange:e=>{_(`tts`,`auto`,e),S(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:o(),children:(0,Y.jsx)($,{value:s.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,_e()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{_(`tts`,`provider`,e),S(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:y(),children:(0,Y.jsx)(q,{value:s.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>_(`tts`,`model`,e.target.value),onBlur:()=>S(`tts`,{model:s.tts.model??``})})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:s.tts.voice??``,placeholder:ne(),onChange:e=>_(`tts`,`voice`,e.target.value),onBlur:()=>S(`tts`,{voice:s.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ee(),status:(0,Y.jsx)(K,{variant:`outline`,children:U()}),note:e.secrets.openai?g():h(),children:[(0,Y.jsx)(Q,{label:ie(),checked:s.talk.enabled??!1,onChange:e=>{_(`talk`,`enabled`,e),S(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:P(),children:(0,Y.jsx)($,{value:s.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{_(`talk`,`realtimeProvider`,e),S(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:s.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>_(`talk`,`realtimeModel`,e.target.value),onBlur:()=>S(`talk`,{realtimeModel:s.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:s.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>_(`talk`,`voice`,e.target.value),onBlur:()=>S(`talk`,{voice:s.talk.voice??``})})}),(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)($,{value:s.talk.transport??`webrtc`,options:[[`webrtc`,ae()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{_(`talk`,`transport`,e),S(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)(q,{value:s.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>_(`talk`,`speechLocale`,e.target.value),onBlur:()=>S(`talk`,{speechLocale:s.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:d(),checked:s.talk.interruptOnSpeech??!0,onChange:e=>{_(`talk`,`interruptOnSpeech`,e),S(`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:se()}),(0,Y.jsx)(K,{variant:`outline`,children:me()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[c(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:oe(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:he(),columns:[{header:D(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:ge(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:pe(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:w(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:j(),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=s(W.integrations.otlpSecret.setOtlpHeaders),n=b(W.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,J.useState)(``),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),c(null);try{await t({headersJson:i}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,Y.jsxs)(Z,{label:L(),children:[(0,Y.jsx)(q,{value:i,placeholder:e?fe():A(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:l||i.trim().length===0,onClick:()=>void d(),children:r()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:_()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:S()})]})}export{Te as IntegrationsTab};
|